#
#        Python GUI - Colors - Swing
#

from GColors import Color as GColor
import java.awt as awt

class Color(GColor):
        
    def __init__(self,red,green,blue,alpha=1.0,_j_color=None):
        if _j_color:
            self._j_color=_j_color
            GColor.__init__(self)
            return
        self._j_color=awt.Color(float(red),float(green),float(blue),alpha) #Float casts are to force Java's method overloading
        GColor.__init__(self)
    
    def get_red(self):
        return float(self._j_color.getRed())/255
    
    def get_blue(self):
        return float(self._j_color.getBlue())/255
    
    def get_green(self):
        return float(self._j_color.getGreen())/255
    
    def get_alpha(self):
        return float(self._j_color.getAlpha())/255
    
    def get_rgb(self):
        return (self.get_red(),self.get_green(),self.get_blue())
    
    def get_rbga(self):
        return (self.get_red(),self.get_green(),self.get_blue(),self.get_alpha())

rgb=Color

def _from_j_color(_j_color):
    return Color(0,0,0,_j_color=_j_color)